from django.db import models
from django.contrib.auth.models import User



class Post(models.Model):
  owner = models.ForeignKey(User)
  slug = models.SlugField(help_text="This will form the URL of the post", blank=True)
  date = models.DateTimeField()
  title = models.CharField(max_length=100)
  footer_thumbnail = models.ImageField(upload_to="media", blank=True, null=True)
  home_thumbnail = models.ImageField(upload_to="media", blank=True, null=True)
  description = models.TextField(blank=True)
  content_image = models.ImageField(upload_to="media", blank=True, null=True)
  content = models.TextField()
  active = models.BooleanField()
  
  
  def __unicode__(self):
        return self.title
    
  @models.permalink
  def get_absolute_url(self):
        return ('postsingle', (), {
            'slug': self.slug
        })
